package com.jielihaofeng.cachekit;

import javax.print.event.PrintEvent;

/**
 * @author Johnnie Wind
 * @description 方法参数加方法执行，可以包装成事件运行器
 * @date 2021/10/25 11:45
 */
public class EventRunner implements Runnable {

    private final IEventHandler handler;
    private final Event<?> event;

    public EventRunner(IEventHandler handler, Event<?> event) {
        this.handler = handler;
        this.event = event;
    }

    @Override
    public void run() {
        handler.handleEvent(event);
    }

    public static void main(String[] args) {
        new EventRunner(new PrintEventHandler(), new Event<>("你好",EventType.PRINT)).run();
    }

}
